import Vue from 'vue'
import axios from 'axios'
import Qs from 'qs'
export const baseURL='http://azc.sxzhongqiu.com';
// export const baseURL='http://192.168.0.109';
 const service = axios.create({
    baseURL: baseURL,
    timeout: 0,
    
})

service.interceptors.request.use(config => {
    config.headers={'Content-Type':'application/json'} 
    
    // 请求之前处理
    // if (config.method === 'post' && config.data.constructor !== FormData) { //如果是图片则不转string
    //     // config.data = Qs.stringify(config.data)
    // }
//     var userinfo=localStorage.getItem("userInfo");
//    if(userinfo != null && userinfo != undefined && userinfo != ""){
//     config.headers={'Content-Type':'application/json',"Authorization":"Bearer "+JSON.parse(userinfo).Token} 
//    }else{
//     config.headers={'Content-Type':'application/json'} 
//    }
    
   
    return config
}, (error) => {
    console.warn("request.error")
    return Promise.reject(error)
})

service.interceptors.response.use((res) => {
    // 响应回来处理
    // if(res.data.data && res.data.data.token){
    //     // 存储token
    //     Vue.prototype.token = res.data.data.token
    // }
    // if(res.data.code === 401){
    //     Vue.prototype.token = ''
    // }
    return res
}, (error) => {
    console.warn("response.error")
    return Promise.reject(error)
})

// GET 请求
export function get(url, params, headers = {}) {
    return service.get(url, {
        params,
        headers
    }).then((res) => {
        return Promise.resolve(res.data)
    }).catch((err) => {
        return Promise.reject(err)
    })
}
// POST 请求
export function post(url, params, headers = {}){

    return service.post(url, params, {
        headers
    }).then((res) => {
        console.log(url,res.data)
        return Promise.resolve(res.data)
    }).catch((err) => {
        return Promise.reject(err)
    })
} 


export const axios_b=axios;
export const _API = {
  
    SendCode: query => post('api/Sms/checksms', query),  //发送验证码

    invit: query => post('api/Login/invit', query),   //验证邀请码
    
    register: query => post('api/Login/register', query),   //注册

    login: query => post('api/Login/Login', query), //登录

    Reset: query => post('api/Member/Reset', query),



    getAttestation: query => post('api/Member/getAttestation', query), //安全认证
    
    upload: query => post('api/Member/upload', query), //上次文件

    addPayPasswd: query => post('api/Member/addPayPasswd', query), //交易密码设置

    getMachine: query => post('api/Machine/getMachine', query),  //矿机列表
    
    addMachine: query => post('api/Member/addMachine', query),  //购买矿机

    getUserMachine: query => post('api/Member/getUserMachine', query),  //我的矿机


    
    getShouYe: query => post('api/Member/getShouYe', query),  //首页接口
 
    getChong: query => post('api/Member/getChong', query),  //usdt 二维码展示

    
    recharge: query => post('api/Member/recharge', query),  //充值usdt
    

    withdrawal: query => post('api/Member/withdrawal', query),  //提币的接口
    convertlist: query => post('api/Member/convertlist', query),  //兑换的接口
    alluserlist: query => post('api/Member/alluserlist', query), // 全部记录接口
    withdrawallist: query => post('api/Member/withdrawallist', query),// 提现记录
    rechargelist: query => post('api/Member/rechargelist', query),  //充值记录

    azcuselist: query => post('api/Member/azcuselist', query),  //AZC全部记录



    getExchange: query => post('api/Member/getExchange', query),   //获取兑换数据的接口

    exchange: query => post('api/Member/exchange', query),   //兑换数量


    transfer: query => post('api/Member/transfer', query),   // 转账接口

    Balance: query => post('api/Member/Balance', query),   // 转账到我的资产接口

    usdtransfer: query => post('api/Member/usdtransfer', query),   // USDT转账接口


    userinfo: query => post('api/Markethall/userinfo', query),   // 用户信息接口

    bannerinfo: query => post('api/Markethall/bannerinfo', query),   // 用户信息接口
    
    // chucount:初级会员数量  zhcount:中级用户数量  gaocount:高级用户数量   chaocount:超级级用户数量
    myteam: query => post('api/Markethall/myteam', query),   // 我的团队接口

    myincome: query => post('api/Markethall/myincome', query),   // 我的团队收益
    
    teamNote: query => post('api/Member/MyTeam', query),   // 我的团队详情里的邀请记录接口

    getHaiBao: query => post('api/Member/getHaiBao', query),   // 我的团队生成海报

    GetRang: query => post('api/Member/GetRang', query),   // 排行榜接口


    getRegister: query => post('api/Register/getRegister', query),   // 获取签到状态接口

    register_roll: query => post('api/Register/register', query),   //   点击签到接口

    dealcash: query => post('api/Markethall/dealcash', query),   //   买入卖出数据接口

    cashlist: query => post('api/Markethall/cashlist', query),   //   交易大厅首页交易数据记录


    entrusshow: query => post('api/Markethall/entrusshow', query),  //数据详情:

    startdeal: query => post('api/Markethall/startdeal', query), //发起交易接口(卖家找买家)接口

    buydirectmpay: query => post('api/Markethall/buydirectmpay', query),  //买家直接找卖家购买接口

    entrustlist: query => post('api/Markethall/entrustlist', query),  //委托(筛选)挂单数据记录

    revoke: query => post('api/Markethall/revoke', query),  //撤销委托接口

    mysalelist: query => post('api/Markethall/mysalelist', query),      //我的挂单数据
    
    myorder: query => post('api/Markethall/myorder', query),      //订单列表:
    
    ordershow: query => post('api/Markethall/ordershow', query),      //订单详情:

    buyaffirmdeal: query => post('api/Markethall/buyaffirmdeal', query),      //订单列表通知交易订单详情里面的确认交易提交:

    sellaffirmdeal: query => post('api/Markethall/sellaffirmdeal', query),   //订单放币接口
    
    article: query => post('api/Article/article', query), 

    gonggao: query => post('api/Article/gonggao', query),   //公告


    editNickName: query => post('api/Member/editNickName', query),   //修改昵称


    bannerinfo: query => post('api/Markethall/bannerinfo', query),   //bannerinfo
    
    addReward: query => post('api/Member/addReward', query),   //认证时候的邀请码

    closeshall: query => post('api/Markethall/closeshall', query),   //交易大厅的开关
  

  
  }


